<template>
  <el-input v-model="display" :disabled="disabled"
    :placeholder="placeholder" type="number"></el-input>
</template>

<script>
export default {
  name: 'to-cent-input',
  props: {
    value: {
      default: '',
      required: true,
      type: [Number, String]
    },
    disabled: {
      default: false,
      required: false,
      type: Boolean
    },
    placeholder: {
      default: '',
      required: false,
      type: String
    }
  },
  computed: {
    display: {
      get() {
        if (this.value) {
          return Number(this.value) / 100
        }
      },
      set(newValue) {
        this.$emit('input', Number(newValue * 100))
      }
    }
  }
}
</script>
